<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>物资一览</title>
    {% load staticfiles %}
    <link type="text/css" rel="stylesheet" href="{% static "css/base.css" %}">
    <link type="text/css" rel="stylesheet" href="{% static "css/view.css" %}">
    <script src="{% static "js/view.js" %}" type="text/javascript"></script>
</head>
<body>
<div>
    <div class="main">
        <div id="cur_date" style="display: none;">{{ cur_year }}-{{ cur_month }}-{{ cur_day }}</div>
        <table style="height: 230px; width: 230px" id="calendar">
            <tr>
                <td><a class="click_label" href="../../../../{{ pre_year }}/{{ pre_month }}/1/view">&lt</a>
                </td>
                <td colspan="5" style="color: orange;">{{ cur_month }}月</td>
                <td><a class="click_label" href="../../../../{{ next_year }}/{{ next_month }}/1/view">&gt</a>
                </td>
            </tr>
            {% for week in dates %}
                <tr>
                    {% for date in week %}
                        <td>
                            <a href="#" id="{% for item in date %}{{ item }}-{% endfor %}"
                               onclick="onDateClick(this)"></a>
                        </td>
                    {% endfor %}

                </tr>
            {% endfor %}

        </table>

        <table style="height: 230px; width: 316px;">
            <tr>
                <td class="table_title">物品</td>
                <td class="table_title">余量</td>
                <td class="table_title">已借</td>
                <td></td>
                <td class="table_title">物品</td>
                <td class="table_title">余量</td>
                <td class="table_title">已借</td>
            </tr>
            <tr>
                <td>胶凳</td>
                <td>{{ chair_left }}</td>
                <td>{{ chair_sum }}</td>
                <td></td>
                <td>桌子</td>
                <td>{{ desk_left }}</td>
                <td>{{ desk_sum }}</td>
            </tr>
            <tr>
                <td>帐篷</td>
                <td>{{ tent_left }}</td>
                <td>{{ tent_sum }}</td>
                <td></td>
                <td>太阳伞</td>
                <td>{{ umbrella_left }}</td>
                <td>{{ umbrella_sum }}</td>
            </tr>
            <tr>
                <td>相机</td>
                <td>{{ red_left }}</td>
                <td>{{ red_sum }}</td>
                <td></td>
                <td>展架</td>
                <td>{{ cloth_left }}</td>
                <td>{{ cloth_sum }}</td>
            </tr>
            <tr>
                <td>麦克风</td>
                <td>{{ loud_left }}</td>
                <td>{{ loud_sum }}</td>
                <td></td>
                <td>音响</td>
                <td>{{ sound_left }}</td>
                <td>{{ sound_sum }}</td>
            </tr>
            <tr>
                <td>投影仪</td>
                <td>{{ projector_left }}</td>
                <td>{{ project_sum }}</td>
            </tr>
        </table>
        <table class="applies">
            {% if  apply_cnt <= 0 %}
                <tr>
                    <td>
                        {{ cur_year }} - {{ cur_month }} - {{ cur_day }} 还没有申请记录 [<a href="../../../../apply"
                                                                                     class="click_label">去申请</a>]
                    </td>
                </tr>
            {% else %}
                <tr>
                    <td class="table_title">活动名称</td>
                    <td class="table_title">申请单位</td>
                    <td class="table_title">申请人</td>
                    <td class="table_title">联系电话</td>
                    <td class="table_title"></td>
                </tr>
                {% for apply in applies %}
                    <tr>
                        <td class="td_divider" colspan="5"></td>
                    </tr>
                    <tr>
                        <td>{{ apply.act_name }}</td>
                        <td>{{ apply.apply_org }}</td>
                        <td class="applicant">{{ apply.applicant }}</td>
                        <td>{{ apply.tel }}</td>
                        <td width="50px">
                            <button class="click_label" value="detail_{{ forloop.counter }}"
                                    onclick="detail(this)">详情
                            </button>
                            <button class="click_label" value="detail_{{ forloop.counter }}" style="display: none;"
                                    onclick="hide(this)">收起
                            </button>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="5">
                            <table id="detail_{{ forloop.counter }}" style="display: none" class="apply_detail">
                                <tr>
                                    <td>胶凳</td>
                                    <td>{{ apply.char_num }}</td>
                                    <td>桌子</td>
                                    <td>{{ apply.desk_num }}</td>
                                    <td>帐篷</td>
                                    <td>{{ apply.tent_num }}</td>
                                    <td>太阳伞</td>
                                    <td>{{ apply.umbrella_num }}</td>
                                </tr>
                                <tr>
                                    <td>相机</td>
                                    <td>{{ apply.red_num }}</td>
                                    <td>展架</td>
                                    <td>{{ apply.cloth_num }}</td>
                                    <td>麦克风</td>
                                    <td>{{ apply.loud_num }}</td>
                                    <td>音响</td>
                                    <td>{{ apply.sound_num }}</td>
                                </tr>
                                <tr>
                                    <td>投影仪</td>
                                    <td>{{ apply.projector }}</td>
                                </tr>
                                <tr>
                                    <td colspan="2">审批人</td>
                                    <td colspan="2">{{ apply.assistant }}</td>
                                    <td><a class="click_label" href="{% url 'mng:apply_modify' apply.id %}">修改</a></td>
                                    <td><a class="click_label" href="#" onclick="apply_remove({{ apply.id }})">删除</a></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                {% endfor %}
            {% endif %}

        </table>
    </div>
</div>

</body>
</html>